import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 11 - 21
 * Time: 10:54
 */
//牛客 淘宝网店
public class Solution18 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int y1 = in.nextInt();
            int m1 = in.nextInt();
            int d1 = in.nextInt();
            int y2 = in.nextInt();
            int m2 = in.nextInt();
            int d2 = in.nextInt();
            int money = 0;
            int[] arrM = new int[] {0, 62, 28, 31, 60, 31, 60, 31, 62, 60, 62, 30, 62};
            int sum1 = 579;
            int sun2 = 580;
            if (y1 == y2 && m1 == m2) {
                if ((m1 == 2) || (m1 == 3) || (m1 == 5) || (m1 == 7) || (m1 == 11)) {
                    money = d2 - d1 + 1;
                } else {
                    money = (d2 - d1 + 1) * 2;
                }
            } else if (y1 == y2 && m1 != m2) {
                if ((y1 % 4 == 0 && y1 % 100 != 0) || y1 % 400 == 0) {
                    arrM[2] = 29;
                }
                int n = m2 - m1;
                while (n != 0) {
                    money += arrM[m1];
                    m1 += 1;
                    n--;
                }
                if ((m2 == 2) || (m2 == 3) || (m2 == 5) || (m2 == 7) || (m2 == 11)) {
                    money += d2;
                } else {
                    money += d2 * 2;
                }
            } else {
                int n = y2 - y1;
                while (n != 0) {
                    if ((y1 % 4 == 0 && y1 % 100 != 0) || y1 % 400 == 0) {
                        money += 580;
                    } else {
                        money += 579;
                    }
                    y1 += 1;
                    n--;
                }
                if ((y2 % 4 == 0 && y2 % 100 != 0) || y2 % 400 == 0) {
                    arrM[2] = 29;
                }
                int m = m2 - 1;
                int x = 1;
                while (m != 0) {
                    money += arrM[x];
                    x += 1;
                    m--;
                }
                if ((m2 == 2) || (m2 == 3) || (m2 == 5) || (m2 == 7) || (m2 == 11)) {
                    money += d2;
                } else {
                    money += d2 * 2;
                }
            }
            System.out.println(money);
        }
    }
}
